package com.etc.entity;

import java.io.Serializable;
import java.util.UUID;

/**
 * 技能基类
 * @author Administrator
 *
 */
public class Skill implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3936343164932052224L;
	protected String skillId;  //技能编号
	protected String skillName;  //技能名字
	protected String skillDesc;   //技能描述
	protected int skillCd;       //技能cd时间
	protected int consumBlue;     //技能伤害百分比
	protected String type;     //技能类型
	protected int attrHeal;     //技能附带的生命值
	protected int attrImage;    //技能附带的魔法值
	protected int attrAttack;   //技能附带的攻击力
	protected int attrCrit;     //技能附带的暴击
	protected int attrDefense;  //技能附带的防御力
	protected int attrSpeed;    //技能附带的速度
	protected int duration;   //技能持续回合数
	protected String classId; //技能所属职业
	protected int availability=0; //技能可用度，当技能为0时表示可用
	protected boolean haveUse = false;
	public boolean isHaveUse() {
		return haveUse;
	}
	public void setHaveUse(boolean haveUse) {
		this.haveUse = haveUse;
	}
	public int getAvailability() {
		return availability;
	}
	public void setAvailability(int availability) {
		this.availability = availability;
	}
	public String getClassId() {
		return classId;
	}
	public void setClassId(String classId) {
		this.classId = classId;
	}
	//使用技能
	public String useSkill(Role role, Role enemy) {
		String msg = "";
		if(type.substring(0, 1).equals("增")) {
			msg = useBuffSkills(role); //使用增益buff
		}else if(type.substring(0, 1).equals("减")) {
			msg = userDebuffSkills(role, enemy); //使用减益buff
		}
		return msg;
	}
	//使用减益buff
	public String userDebuffSkills(Role role, Role enemy) {
		String msg = "";
		if(type.equals("减伤技能") && availability==0 && (haveUse==false)) {
			msg = reduceAttack(role, enemy);
		}
		else if(type.equals("减血技能") && availability==0 && (haveUse==false)) {
			msg = reduceHeal(role, enemy);
		}
		else if(type.equals("减蓝技能") && availability==0 && (haveUse==false)) {
			msg = reduceImage(role, enemy);
		}
		else if(type.equals("减暴技能") && availability==0 && (haveUse==false)) {
			msg = reduceCritical(role, enemy);
		}
		else if(type.equals("减防技能") && availability==0 && (haveUse==false)) {
			msg = reduceDefense(role, enemy);
		}
		else if(type.equals("减速技能") && availability==0 && (haveUse==false)) {
			msg = reduceSpeed(role, enemy);
		}
		return msg;
	}
	//使用增益buff
	public String useBuffSkills(Role role) {
		String msg = "";
		if(type.equals("增伤技能") && availability==0 && (haveUse==false)) {
			msg = addAttack(role);
		}
		else if(type.equals("增血技能") && availability==0 && (haveUse==false)) {
			msg = addHeal(role);
		}
		else if(type.equals("增蓝技能") && availability==0 && (haveUse==false)) {
			msg = addImage(role);
		}
		else if(type.equals("增暴技能") && availability==0 && (haveUse==false)) {
			msg = addCritical(role);
		}
		else if(type.equals("增防技能") && availability==0 && (haveUse==false)) {
			msg = addDefense(role);
		}
		else if(type.equals("增速技能") && availability==0 && (haveUse==false)) {
			msg = addSpeed(role);
		}
		return msg;
	}
	//进行一个回合
	
	public void endRound(Role role) {
		
	}
	public String addHeal(Role role) {
		return null;
	}
	public String addAttack(Role role) {
		return null;
	}
	public String addImage(Role role) {
		return null;
	}
	public String addCritical(Role role) {
		return null;
	}
	public String addDefense(Role role) {
		return null;
	}
	public String addSpeed(Role role) {
		return null;
	}
	public String reduceHeal(Role role, Role enemy) {
		return null;
	}
    public String reduceAttack(Role role, Role enemy) {
    	return null;
	}
	public String reduceImage(Role role, Role enemy) {
		return null;
	}
	public String reduceCritical(Role role, Role enemy) {
		return null;
	}
	public String reduceDefense(Role role, Role enemy) {
		return null;
	}
	public String reduceSpeed(Role role, Role enemy) {
		return null;
	}
	
	
	public Skill(String skillName, String skillDesc, int skillCd, int consumBlue, String type, int attrHeal,
			int attrImage, int attrAttack, int attrCrit, int attrDefense, int attrSpeed, int duration, String classId) {
		super();
		this.skillId = UUID.randomUUID().toString().substring(0, 8);
		this.skillName = skillName;
		this.skillDesc = skillDesc;
		this.skillCd = skillCd;
		this.consumBlue = consumBlue;
		this.type = type;
		this.attrHeal = attrHeal;
		this.attrImage = attrImage;
		this.attrAttack = attrAttack;
		this.attrCrit = attrCrit;
		this.attrDefense = attrDefense;
		this.attrSpeed = attrSpeed;
		this.duration = duration;
		this.classId = classId;
	}
	public Skill(String skillId, String skillName, String skillDesc, int skillCd, int consumBlue, String type,
			int attrHeal, int attrImage, int attrAttack, int attrCrit, int attrDefense, int attrSpeed, int duration, String classId) {
		super();
		this.skillId = skillId;
		this.skillName = skillName;
		this.skillDesc = skillDesc;
		this.skillCd = skillCd;
		this.consumBlue = consumBlue;
		this.type = type;
		this.attrHeal = attrHeal;
		this.attrImage = attrImage;
		this.attrAttack = attrAttack;
		this.attrCrit = attrCrit;
		this.attrDefense = attrDefense;
		this.attrSpeed = attrSpeed;
		this.duration = duration;
		this.classId = classId;
	}
	public Skill() {
		super();
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getSkillId() {
		return skillId;
	}
	public void setSkillId(String skillId) {
		this.skillId = skillId;
	}
	public String getSkillName() {
		return skillName;
	}
	public void setSkillName(String skillName) {
		this.skillName = skillName;
	}
	public String getSkillDesc() {
		return skillDesc;
	}
	public void setSkillDesc(String skillDesc) {
		this.skillDesc = skillDesc;
	}
	public int getSkillCd() {
		return skillCd;
	}
	public void setSkillCd(int skillCd) {
		this.skillCd = skillCd;
	}
	public int getConsumBlue() {
		return consumBlue;
	}
	public void setConsumBlue(int consumBlue) {
		this.consumBlue = consumBlue;
	}
	public int getAttrHeal() {
		return attrHeal;
	}
	public void setAttrHeal(int attrHeal) {
		this.attrHeal = attrHeal;
	}
	public int getAttrImage() {
		return attrImage;
	}
	public void setAttrImage(int attrImage) {
		this.attrImage = attrImage;
	}
	public int getAttrAttack() {
		return attrAttack;
	}
	public void setAttrAttack(int attrAttack) {
		this.attrAttack = attrAttack;
	}
	public int getAttrCrit() {
		return attrCrit;
	}
	public void setAttrCrit(int attrCrit) {
		this.attrCrit = attrCrit;
	}
	public int getAttrDefense() {
		return attrDefense;
	}
	public void setAttrDefense(int attrDefense) {
		this.attrDefense = attrDefense;
	}
	public int getAttrSpeed() {
		return attrSpeed;
	}
	public void setAttrSpeed(int attrSpeed) {
		this.attrSpeed = attrSpeed;
	}
	public int getDuration() {
		return duration;
	}
	public void setDuration(int duration) {
		this.duration = duration;
	}
	@Override
	public String toString() {
		return "Skill [skillId=" + skillId + ", skillName=" + skillName + ", skillDesc=" + skillDesc + ", skillCd="
				+ skillCd + ", consumBlue=" + consumBlue + ", type=" + type + ", attrHeal=" + attrHeal + ", attrImage="
				+ attrImage + ", attrAttack=" + attrAttack + ", attrCrit=" + attrCrit + ", attrDefense=" + attrDefense
				+ ", attrSpeed=" + attrSpeed + ", duration=" + duration + ", classId=" + classId + "]\n";
	}
	
	
	
}
